package com.sabeot.library.hibernate.dao.impl;

import java.util.List;

import org.hibernate.criterion.MatchMode;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import com.sabeot.library.hibernate.dao.UserDAO;
import com.sabeot.library.hibernate.dto.User;

@Repository
public class UserDAOImpl extends AbstractDAOImpl<User, Long> implements UserDAO {

	protected UserDAOImpl(){
		super(User.class);
	}

	public void saveUser(User user) {
		saveOrUpdate(user);
	}

	public List findUsers(String login) {
		return findByCriteria(Restrictions.like("login", login, MatchMode.ANYWHERE));
	}

}
